package cn.wostore.wxhelper.utils;

import android.content.Context;
import cn.wostore.wxhelper.R;
import net.sqlcipher.database.SQLiteDatabase;
import net.sqlcipher.database.SQLiteOpenHelper;

/**
 * @author wuch
 * @date 2018/12/27 0027
 */
public class MyDatabaseHelper extends SQLiteOpenHelper {
    private static final String TAG = MyDatabaseHelper.class.getSimpleName();

    private Context context;
    private static final int DB_VERSION = 1;
    public static final String DB_NAME = "forward_data";

    public MyDatabaseHelper(Context context) {
        super(context, DB_NAME, null, DB_VERSION);
        L.d(TAG, "MyDatabaseHelper create "+context);
        this.context = context;
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(context.getString(R.string.create_ForwardRule));
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int i, int i1) {
        db.execSQL("DROP TABLE IF EXISTS " + DB_NAME);
        onCreate(db);
    }
}


